﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Entity;

namespace Web.admin.OutterManage.OutterAwardsManage
{
    public partial class OutterAwards : System.Web.UI.Page
    {
        private AwardService awardService = new AwardService();
        private StudentService studentService = new StudentService();
        private GroupsService groupsService = new GroupsService();
        private ParticipantService participantService = new ParticipantService();
        private AcademyService academyService = new AcademyService();
        private ContestService contestService = new ContestService();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string id = Request["id"];
                if (String.IsNullOrEmpty(id))
                    return;

                ContestId.Value = id;
                Rp_Bind(id);
            }
        }

        /// <summary>
        /// repeater绑定
        /// </summary>
        /// <param name="Con_Id"></param>
        protected void Rp_Bind(string Con_Id)
        {
            BLL.CompetitionService competitionservice = new CompetitionService();
            BoCompetitions CompetitionsModel = competitionservice.getCompetitionsByContest(Con_Id);
            if (CompetitionsModel.COM_FORM == 0)//为个人报名
            {
                btn_AddStudent.Visible = true;
                btn_AddGroup.Visible = false;
            }
            else
            {
                btn_AddStudent.Visible = false;
                btn_AddGroup.Visible = true;
            }
            RpList.DataSource = participantService.getAwardsPar(Con_Id);//查看获奖学生和小组 不显示只报名为获奖的人
            RpList.DataBind();
        }

        protected void btnAddStudent_Click(object sender, EventArgs e)
        {
            if (ContestId.Value == "")
                return;

            Response.Redirect("awardStu.aspx?ContestId=" + ContestId.Value);
        }

        protected void btnAddGroup_Click(object sender, EventArgs e)
        {
            if (ContestId.Value == "")
                return;

            Response.Redirect("awardGro.aspx?ContestId=" + ContestId.Value);
        }
    }
}